<div id="viewer-container"></div>
<script>
  let viewer = undefined

  function generatePosition(num) {
    var list = []
    for (var i = 0; i < num; i++) {
      var lng = 120.38105869 + Math.random() * 0.5
      var lat = 31.10115627 + Math.random() * 0.5
      list.push(new DC.Position(lng, lat))
    }
    return list
  }

  function initViewer() {
    viewer = new DC.Viewer('viewer-container')
    let baselayer = DC.ImageryLayerFactory.createBaiduImageryLayer({
      style: 'dark'
    })
    baselayer.defaultBrightness = 0.1
    viewer.addBaseLayer(baselayer)
    let layer = new DC.VectorLayer('layer')
    viewer.addLayer(layer)
    let positions = generatePosition(10)
    positions.forEach(item => {
      let circle = new DC.Circle(item, 1000)
      circle.setStyle({
        material: new DC.CircleWaveMaterialProperty({
          color: DC.Color.fromRandom(),
          count: 3,
          gradient: 0.9
        })
      })
      layer.addOverlay(circle)
    })

    viewer.flyTo(layer)
  }
  DC.ready(initViewer)
</script>
